also called zero-mean normalization. The values of attribute X
are
normalized using the mean and standard deviation of X
. A new value
new_v
is obtained using the following expression:
new_v = (v - mX) / sX
where mX
and sX
are the mean and standard deviation of attribute X
,
respectively. After zero-mean normalizing each feature will have a mean
value of 0. Also, the unit of each value will be the number of (estimated)
standard deviations away from the (estimated) mean.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(grid_real), | intent(in) | :: | gridIn | |||
type(grid_real), | intent(inout) | :: | gridOut |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=short), | public | :: | i | ||||
integer(kind=short), | public | :: | j | ||||
real(kind=float), | public | :: | mean | ||||
real(kind=float), | public | :: | std |
SUBROUTINE ZscoreNormalizationFloat & ! (gridIn, gridOut) IMPLICIT NONE !Arguments with intent(in): TYPE (grid_real), INTENT(IN) :: gridIn !Arguments with intent(inout): TYPE (grid_real), INTENT(INOUT) :: gridOut !Local declaration INTEGER (KIND = short) :: i, j REAL (KIND = float) :: mean, std !---------------------end of declarations-------------------------------------- !get mean mean = GetMean (gridIn) !get standard deviation std = getStDev (gridIn) !normalize grid. gridout is supposed to be initialized outside the subroutine DO i = 1, gridIn % idim DO j = 1, gridIn % jdim IF (gridIn % mat (i,j) /= gridIn % nodata) THEN gridOut % mat (i,j) = (gridIn % mat (i,j) - mean) / std END IF END DO END DO RETURN END SUBROUTINE ZscoreNormalizationFloat